<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增流程节点跳过条件配置')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-stepskip-add">
        <div class="form-group">
            <input type="hidden" name="versionId" id="versionId" th:value="${versionId}"/>
            <input type="hidden" name="stepId" id="stepId" th:value="${stepId}"/>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">条件说明：</label>
            <div class="col-sm-8">
                <input name="conditionDesc" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">取值SQL：</label>
            <div class="col-sm-8">
                <textarea name="valSql" class="form-control" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">比较类型：</label>
            <div class="col-sm-8">
                <select name="compareType" class="form-control m-b"
                        th:with="type=${@dict.getType('wflstepskip_compare_type')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">比较值类型：</label>
            <div class="col-sm-8">
                <select name="compareValType" class="form-control m-b"
                        th:with="type=${@dict.getType('wfl_compare_val_type')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">比较值：</label>
            <div class="col-sm-8">
                <input name="compareVal" class="form-control" type="text" required>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "workflow/stepskip"
    $("#form-stepskip-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {

            var code = -1;
            $.ajax({
                url: prefix + "/add",
                data: $('#form-stepskip-add').serialize(),
                async: false,
                type: "post",
                success: function (result) {
                    code = result.code;
                }
            });
            if (code == 0) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
</script>
</body>
</html>